package com.zbkj.admin.task.product;

import com.zbkj.common.utils.CrmebDateUtil;
import com.zbkj.service.service.ProductAttrValueService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 新增商品自动跑ai换衣图task任务
 */
@Component("ProductAiTask")
public class ProductAiTask {
    //日志
    private static final Logger logger = LoggerFactory.getLogger(ProductAiTask.class);

    @Autowired
    private ProductAttrValueService productAttrValueService;

    /**
     * 1分钟同步一次数据
     */
    public void productAiAutoCancel() {
        // cron : 0 */1 * * * ?
        logger.info("---ProductAiTask task------新增商品自动跑ai换衣图task任务--ProductAiTask - {}", CrmebDateUtil.nowDateTime());
        try {
            productAttrValueService.productAiAutoCancel();
        } catch (Exception e) {
            e.printStackTrace();
            logger.error("ProductAiTask.task" + " | msg : " + e.getMessage());
        }
    }
}
